<template>
  <div id="app">
    <!--<div id="nav">-->
    <!--<router-link to="/">Home</router-link> |-->
    <!--<router-link to="/about">About</router-link>-->
    <!--</div>-->
    <router-view />
  </div>
</template>
<script>
export default {
  name: "App",
  data() {
    return {
      currentRouter: ""
    };
  },
  mounted() {
    this.currentPath = this.$route.path;
    this.currentQuery = this.$route.query;
    console.log(this.currentPath.slice(4));
    console.log(this.currentPath);
    console.log(this.currentQuery);
    if (this._isMobile()) {
      this.$router.push({
        path: "/wap" + this.currentPath.slice(4),
        query: this.currentQuery
      });
    } else {
      this.$router.push({
        path: "/web" + this.currentPath.slice(4),
        query: this.currentQuery
      });
    }
    document.addEventListener("keydown", e => {
      if (e.keyCode === 122) {
        e.preventDefault();
      }
    });
  },
  methods: {
    _isMobile() {
      let flag = navigator.userAgent.match(
        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
      );
      localStorage.setItem("ismobile", flag ? 1 : 0);
      return flag;
    }
  }
};
</script>
<style lang="less">
body {
  overflow: auto !important;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  touch-action: none;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
.el-tooltip__popper {
  border-radius: 6px;
}
.el-tooltip__popper.is-dark {
  background: #2992fd;
  color: #fff;
}
.el-tooltip__popper[x-placement^="top"] .popper__arrow::after {
  border-top-color: #2992fd;
}
</style>
